﻿<div class="row">
    <div class="col-xs-12 col-md-12 col-lg-12">
        <div class="widget">
            <div class="widget-header bg-blue">
            	<i class="widget-icon fa fa-arrow-left"></i>
                <span class="widget-caption">自定义菜单</span>
                <div class="widget-buttons">
                    <a href="#" data-toggle="maximize">
                        <i class="fa fa-expand"></i>
                    </a>
                    <a href="#" data-toggle="collapse">
                        <i class="fa fa-minus"></i>
                    </a>
                    <a href="#" data-toggle="dispose">
                        <i class="fa fa-times"></i>
                    </a>
                </div>
            </div>
            <div class="widget-body" style="height: auto;">
				
				<div class="form-title">
                    <a href="/Admin/Wx/menu" class="btn btn-primary" data-loader="bb-loader" data-loadername="自定义菜单">
						<i class="fa fa-mail-reply"></i>返回
					</a>
                </div>
                
                <form id="bbForm" action="" method="post" class="form-horizontal"
                                                  data-bv-message=""
                                                  data-bv-feedbackicons-valid="glyphicon glyphicon-ok"
                                                  data-bv-feedbackicons-invalid="glyphicon glyphicon-remove"
                                                  data-bv-feedbackicons-validating="glyphicon glyphicon-refresh">
                <input type="hidden" name="id" value="{$nemudata.id}">
                <input type="hidden" name="wx_id" value="{$wx_id}">
                	
                 <div class="form-group">
                        <label class="col-lg-2 control-label">选择父菜单</label>
                        <div class="col-lg-4">
                             <select class="form-control" name="pid" >
                                 <option value="0">顶级菜单</option>
                                 <volist name="nemupid" id="vo">
                                 	<option value="{$vo.id}" <eq name="vo.id" value="$nemudata['pid']" > selected="selected" </eq> >{$vo.name}</option>
                                 </volist>
                             </select>
                        </div>
                 </div>
                 
				<div class="form-group">
				    <label class="col-lg-2 control-label">菜单名称<sup>*</sup></label>
				    <div class="col-lg-4">
				    <input type="text" class="form-control" name="name" placeholder="必填"
				                                           data-bv-notempty="true"
				                                           data-bv-notempty-message="不能为空" value="{$nemudata.name}">
				    </div>
				</div>

				 <div class="form-group">
                        <label class="col-lg-2 control-label">自定义菜单类型<sup>*</sup></label>
                        <div class="col-lg-4">
                    		<select id="typechange" name="type" data-bv-field="type" >
                    			<option value="view" <eq name="view" value="$nemudata['type']" > selected="selected" </eq> >网址［VIEW］</option>
                    			<option value="click" <eq name="click" value="$nemudata['type']" > selected="selected" </eq> >关键词［CLICK］</option>
                    		</select>
                    		<i class="form-control-feedback" data-bv-field="type" style="display: none;"></i>
                        </div>
                   </div>
                   
                   <div class="form-group" id="url">
                        <label class="col-lg-2 control-label">网址</label>
                        <div class="col-lg-4">
                        	<input type="text" class="form-control" name="url" placeholder="" value="{$nemudata.url}">
                        </div>
                   </div>
                   
                   <div class="form-group" id="key">
                        <label class="col-lg-2 control-label">关键词</label>
                        <div class="col-lg-4">
                        	<input type="text" class="form-control" name="key" placeholder="" value="{$nemudata.key}">
                        </div>
                   </div>
                   
                   <div class="form-group">
                        <label class="col-lg-2 control-label">排序</label>
                        <div class="col-lg-4">
                        	<input type="text" class="form-control" name="sort" placeholder="" value="{$nemudata.sort}">
                        </div>
                   </div>
                	
                   <div class="form-group">
                             <div class="col-lg-offset-2 col-lg-4">
                             <button class="btn btn-primary btn-lg" type="submit">保存</button>&nbsp;&nbsp;&nbsp;&nbsp;
                             <button class="btn btn-palegreen btn-lg" type="reset">重填</button>
                        </div>
                    </div>
            </div>
        </div>
    </div>
</div>
<!--面包屑导航封装-->
<div id="tmpbread" style="display: none;">{$breadhtml}</div>
<script type="text/javascript">
	setBread($('#tmpbread').html());
</script>

<!--表单验证与提交封装-->
<script type="text/javascript">
	$('#bbForm').bootstrapValidator({
		submitHandler: function (validator, form, submitButton) {
           var tourl="{:U('Admin/Wx/menu_set')}";
           var data=$('#bbForm').serialize();
           $.bb.ajax('post',tourl,data,null);
           return false;
        },
	});
	
	$(function(){
		var type='{$nemudata.type}';
		if(type=='view'){
			$('#key').hide();
			$('#url').show();
		}else if(type=='click'){
			$('#key').show();
			$('#url').hide();
		}
	})
	//============================================
	$('#typechange').change(function(){ 
		var v=$(this).children('option:selected').val();
		if(v=='view'){
			$('#key').hide();
			$('#url').show();
		}else if(v=='click'){
			$('#key').show();
			$('#url').hide();
		}
	});
</script>
<!--/表单验证与提交封装-->